/*
 * name:找回密码初始化 FindPasswordInit
 * author:yanmu.wj@taobao.com
 * date:2011-11-22
 */
KISSY.use('UserName,Password,ImageCheckCode,SubmitForm',function(S,UserName,Password,ImageCheckCode,SubmitForm){
    KISSY.ready(function(){
        var $ = S.all;

        //账户名校验
        var username = UserName({
            input:'#J_username_input',
            tip:'#J_username_tip',
            placeholder:'#J_username_ph',
            checkUrl:'', //S.one('#J_alipayopt_checkUrl').val()
            defaultTip:{type:'tips',msg:{content:'忘记会员名？就使用手机号或邮箱吧！'}}
        }).init();

        //密码校验
        var password = Password({
            input:'#J_password_input',
            reinput:'#J_repassword_input',
            tip:'#J_password_tip',
            retip:'#J_repassword_tip',
            strength:'#J_password_strength',
            strengthInput:'J_password_rank',
            strengthCls:{
                weak:'pw_weak',
                medium:'pw_medium',
                strong:'pw_strong'
            },
            reinput:'#J_repassword_input',
            retip:'#J_repassword_tip',
            defaultTip:{type:'attention',msg:{content:'1.为保证您的安全，新密码必须与旧密码不同。<br />2.密码由6-16位字符(字母、数字、符号)组合而成，不能只使用一种字符，区分大小写。'}},
            redefaultTip:{type:'attention',msg:{content:'请再输一次密码'}}
        }).init();

        //图片验证码
        var imageCheckCode = ImageCheckCode({
            input:'#J_checkcode_input',
            img:'#J_checkcode',
            getUrl:'http://regcheckcode.taobao.com/auction/checkcode?sessionID=2d9ec3d19e5bb9aded17340499cc244c',
            checkUrl:'',
            trigger:'#J_refresh_checkcode',
            tip:'#J_checkcode_tip',
            defaultTip:{type:'tips',msg:{content:'请输入图片上的验证码！'}}
        }).init();

        //找回密码第一步：登录
        SubmitForm({
            form:'#J_login_form',
            tip:'#J_login_form_tip',
            checkers:[username,imageCheckCode]
        }).init();
        
        //找回密码第三步：重置密码
        SubmitForm({
            form:'#J_reset_password_form',
            tip:'#J_reset_password_form_tip',
            checkers:[password]
        }).init();
    });
})
